﻿using Abp.Application.Services;
using Abp.Application.Services.Dto;
using AbpZeroTemplate.Timing;
using AbpZeroTemplate.Timing.Dto;
using AbpZeroTemplate.Web.Controllers;
using AbpZeroTemplate.Web.Swagger;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace AbpZeroTemplate.Api.Admin.Controllers
{
    /// <summary>时间配置
    /// </summary>
    [Area("Admin")]
    [Route("Admin/Timing/[action]")]
    [ApiName("Admin")]
    [RemoteService]
    public class TimingController : AbpZeroTemplateControllerBase
    {
        private readonly ITimingAppService _timingAppService;
        /// <summary>ctor
        /// </summary>
        public TimingController(ITimingAppService timingAppService)
        {
            _timingAppService = timingAppService;
        }

        /// <summary>获取时区
        /// </summary>
        [HttpGet]
        public async Task<ListResultDto<NameValueDto>> GetTimezones([FromQuery]GetTimezonesInput input)
        {
            return await _timingAppService.GetTimezones(input);
        }

        /// <summary>获取时间选择
        /// </summary>
        [HttpGet]
        public async Task<List<ComboboxItemDto>> GetTimezoneComboboxItems([FromQuery]GetTimezoneComboboxItemsInput input)
        {
            return await _timingAppService.GetTimezoneComboboxItems(input);
        }
    }
}
